package com.aabte.design.pattern.structural.composite;

public class Test {
    public static void main(String[] args) {

        CatalogComponent linux = new Course("Linux", 20.1);
        CatalogComponent windows = new Course("Windows", 22.2);


        CatalogComponent javaCourseCatalog = new CourseCatalog("Java目录", 2);

        CatalogComponent mmallCourse1 = new Course("Java一期", 33.3);
        CatalogComponent mmallCourse2 = new Course("Java二期", 44.4);

        javaCourseCatalog.add(mmallCourse1);
        javaCourseCatalog.add(mmallCourse2);


        CatalogComponent mainCourseCatalog = new CourseCatalog("全部课程目录");

        mainCourseCatalog.add(linux);
        mainCourseCatalog.add(windows);
        mainCourseCatalog.add(javaCourseCatalog);


        mainCourseCatalog.print();

    }
}
